package edu.gdkm.sql.dao;

import edu.gdkm.sql.pojo.Product;
import edu.gdkm.sql.pojo.Userinfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserinfoMapper {
    // 查询全部类别
    @Select("select * from userinfo")
    List<Userinfo> findAll();
    // 根据id查询类别
    @Select("SELECT * FROM userinfo WHERE id = #{id}")
    Userinfo findById(int id);

    @Insert("INSERT INTO userinfo(username,password,name,address,phone) VALUES(#{username},#{password},#{name},#{address},#{phone})")
    int insertUserinfo(Userinfo userinfo);

    // 更新类别
    @Update("UPDATE userinfo SET username=#{username},password=#{password},name=#{name},address=#{address},phone=#{phone} WHERE id=#{id}")
    int updateUserinfoById(Userinfo userinfo);

    // 删除类别
    @Delete("DELETE FROM userinfo WHERE id=#{id}")
    int deleteUserinfoById(int id);
}
